Skip to content

Conversation

@vbvictor
Copy link
Contributor

@vbvictor vbvictor commented Nov 7, 2025

No description provided.

@@ -1,4 +1,6 @@
InheritParentConfig: true
HeaderFilterRegex: 'clang-tools-extra/clang-tidy'
ExcludeHeaderFilterRegex: 'include-cleaner|clang-query'
Copy link
Contributor Author

@vbvictor vbvictor Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to do this because I got errors from files like this:

llvm/llvm-project/clang-tools-extra/clang-tidy/misc/../../include-cleaner/include/clang-include-cleaner/Types.h:22:9

So it matched on regex clang-tools-extra/clang-tidy but actually it's header from another subproject.

If anyone have better ideas - please tell!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the relevant code:

const StringRef FileName(File->getName());
LastErrorRelatesToUserCode = LastErrorRelatesToUserCode ||
Sources.isInMainFile(Location) ||
(getHeaderFilter()->match(FileName) &&
!getExcludeHeaderFilter()->match(FileName));

Maybe we should normalize FileName before matching on it? i.e.:

clang-tools-extra/clang-tidy/misc/../../include-cleaner/include/clang-include-cleaner/Types.h
->
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, the reason we have these relative paths in the first place is because include-cleaner forces us to do this:

include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/../../include-cleaner/include")

...which is just really ugly. I've opened #167110 to fix it. (It happens to also fix this problem, but I think there's an underlying problem on our end too.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI same happens with clang-query headers that also emit relative paths

Copy link
Contributor

@localspook localspook Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's right, that PR doesn't fully fix this problem then

Copy link
Contributor

@EugeneZelenko EugeneZelenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK for me, but please wait for other reviewers.

@vbvictor
Copy link
Contributor Author

I think we can proceed to merge "as is" given CMake changes will take time to be merged, and they won't fix the whole problem.

WDYT?

@localspook
Copy link
Contributor

That sounds reasonable, we can merge this

@vbvictor vbvictor merged commit 751a943 into llvm:main Nov 13, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants